package org.gaaidou.ptarmigan.springboot.core.serialize.json;

import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector;

public class DefaultAnnotationIntrospector extends NopAnnotationIntrospector {
    @Override
    public Object findSerializer(Annotated am) {
        Desensitize desensitize = am.getAnnotation(Desensitize.class);
        if (desensitize != null) {
            DesensitizationDataSerializer dataSerializer = new DesensitizationDataSerializer();
            dataSerializer.setDesensitize(desensitize);
            return dataSerializer;
        }
        Ignore ignore = am.getAnnotation(Ignore.class);
        if (ignore != null) {
            return IgnoreDataSerializer.class;
        }
        return null;
    }
}